#######################################################################################
# Sample make file. It is mainly used under MinGW32 environment.
# NOTES:
# 1. When exe "make", if you don't specify the target, the first target will be executed
# 2. BE SURE to provide the dependencies for each *.o object's generation
########################################################################################
CXX =		gcc
INCLUDES +=	-I"C:\MiniGW\include" \
		-I"C:\MiniGW\include\c++\3.4.5" \
		-I"C:\MiniGW\include\c++\3.4.5\backward" \
		-I"C:\MiniGW\include\c++\3.4.5\mingw32" \
		-I"C:\MiniGW\lib\gcc\mingw32\3.4.5\include" \
		-I"../src"

# -g    means to generate the debug information
# -Wall means to generate the extra warning information for virtual table, and so on
# -M    means to generate the information about the relationship between file, for example
#       the source files that the object file relys on
# -MD   the same with -M but the generated file-relation file will be stored in *.d file
CFLAGS =	-Wall -g $(INCLUDES) -MD

# Whether to optimize, can be O0, O1, O2, O3, O0 means no optimization
CFLAGS +=	-O2 -static
CPPFLAGS =	$(CFLAGS)

LIBPATH =	-L"../lib"
LIBS =		-lrsa

OBJECTS =	tst_bigint.o \
		tst_helper.o \
		tst_rsa.o \
		tst_main.o

tst_bigint.o:	tst_bigint.c
	$(CXX) $(INCLUDES) $(CFLAGS) -c $^ -o $@

tst_rsa.o:	tst_rsa.c
	$(CXX) $(INCLUDES) $(CFLAGS) -c $^ -o $@

tst_helper.o:	tst_helper.c
	$(CXX) $(INCLUDES) $(CFLAGS) -c $^ -o $@

tst_main.o:	tst_main.c
	$(CXX) $(INCLUDES) $(CFLAGS) -c $^ -o $@


OUTPUT =	../bin/rsa_test.exe

all: $(OBJECTS)
	$(CXX) $(LIBPATH) -o $(OUTPUT) $^ $(LIBS) 

clean:
	-rm -f *.o *.d *.~*